<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','admin');
?>
<div class="pad_10">
<script language="javascript">
<!--
	$(function(){
		$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
		$("#cn_name").formValidator({onshow:"请输入中文名称",onfocus:"请输入中文名称",oncorrect:"正确"}).inputValidator({min:1,onerror:"请输入中文名称"});
		$("#en_name").formValidator({onshow:"请输入英文标识",onfocus:"请输入英文标识",oncorrect:"正确"}).inputValidator({min:1,onerror:"请输入英文标识"});
		$("#source_code").formValidator({onshow:"请输入来源编码",onfocus:"请输入来源编码",oncorrect:"正确"}).inputValidator({min:1,onerror:"请输入来源编码"});
		$("#logo").formValidator({onshow:"请上传LOGO",onfocus:"请上传LOGO",oncorrect:"正确"}).inputValidator({min:1,onerror:"请上传LOGO"});
		$('#reg_theme').formValidator({onshow:"请选择报名主题",onfocus:"请选择报名主题",oncorrect:"<?php echo L('right')?>"}).inputValidator({min:1,onerror:"请选择报名主题"});	
	})
//-->
</script>
<form action="?m=reg_child&c=source&a=add" method="post" name="myform" id="myform">
<table cellpadding="2" cellspacing="1" class="table_form" width="100%">
	
	<tr>
		<th width="100"><?php echo L('menu_parentid')?> :</th>
		<td>
			<select name="source[parentid]" id="source_parentid">
				<option value="0"><?php echo L('no_parent_menu')?></option>
				<?php echo $select_categorys;?>
			</select>
		</td>
	</tr>
	<tr>
		<th width="100"><?php echo L('cn_name')?> :</th>
		<td>
			<input name="source[cn_name]" id="cn_name" class="input-text" type="text" size="40">
		</td>
	</tr>
	<tr>
		<th width="100"><?php echo L('en_name')?> :</th>
		<td>
			<input name="source[en_name]" id="en_name" class="input-text" type="text" size="40">
		</td>
	</tr>
	<tr>
		<th width="100"><?php echo L('logo');?> :</th>
		<td><?php echo form::images('source[logo]', 'logo', '', 'reg_child', '', 40)?>
		</td>
	</tr>
	
	<tr>
		<th><?php echo L('source_code')?> :</th>
		<td>
			<input name="source[source_code]" id="source_code" class="input-text" type="text" size="40" <?php if($parent_id!=0){echo "readonly='true' value='".$data['source_code']."'";}?>>
		</td>
	</tr>
	
	<tr>
		<th><?php echo L('reg_theme')?> :</th>
		<td>
			<?php echo form::select($reg_info,'','name="source[reg_theme_id]" id="reg_theme"','请选择报名主题');?>
		</td>
	</tr>
	
	<!-- <tr>
		<th><?php echo L('qrcode_width')?> :</th>
		<td>
			<input name="qrcode_width" id="qrcode_width" class="input-text" type="text" size="40" value="">
		</td>
	</tr>
	<tr>
		<th><?php echo L('qrcode_height')?> :</th>
		<td>
			<input name="qrcode_height" id="qrcode_height" class="input-text" type="text" size="40" value="">
		</td>
	</tr> -->

<tr>
		<th></th>
		<td>
<input type="hidden"name="from_api" value="<?php echo $_GET['from_api'];?>">
<input type="submit" name="dosubmit" id="dosubmit" class="dialog"
		value=" <?php echo L('submit')?> "></td>
	</tr>

</table>
</form>
</div>
</body>
</html>
<script language="javascript" type="text/javascript">
$("#source_parentid").change(function(){
	var parentid = $(this).val();
	if(parentid !=0){
		$.ajax({
			type:"POST",
			url:"?m=reg_child&c=source&a=source_code&pc_hash=<?php echo $_SESSION['pc_hash']?>",
			data:{"parentid":parentid},
			dataType:"JSON",
			success:function(data){
				$("#source_code").attr("readonly","true");
				$("#source_code").val(data.source_code);
			}
		});
	} else {
		$("#source_code").removeAttr("readonly","true");
		$("#source_code").val('');
	}
});
function AdsType(adstype) {
	$('#SizeFormat').css('display', 'none');
	if(adstype=='0') {
		
	} else if(adstype=='1') {
		$('#SizeFormat').css('display', '');
	}
}
$('#AlignBox').click( function (){
	if($('#AlignBox').attr('checked')) {
		$('#PaddingLeft').attr('disabled', true);
		$('#PaddingTop').attr('disabled', true);
	} else {
		$('#PaddingLeft').attr('disabled', false);
		$('#PaddingTop').attr('disabled', false);
	}
}); 
</script>

<script language="javascript">

</script>